package com.zp.self.springboot.自动装配.ImportBeanDefinitionRegistrar接口;

import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

public class MyImportBeanDefinitionRegistrar implements ImportBeanDefinitionRegistrar {

    @Override
    //实现相关方法
    public void registerBeanDefinitions(AnnotationMetadata annotationMetadata, BeanDefinitionRegistry beanDefinitionRegistry) {
        RootBeanDefinition rootBeanDefinition = new RootBeanDefinition(Person_2.class);
        // 注册一个名字叫做 Person 的 bean
        beanDefinitionRegistry.registerBeanDefinition("Person_2", rootBeanDefinition);
    }

}

